
def is_64bit_pe(exe_path: str):
    try:
        with open(exe_path, 'rb') as f:
            # MZ header
            if f.read(2) != b'MZ':
                return False
            # e_lfanew offset
            f.seek(0x3C)
            pe_offset = int.from_bytes(f.read(4), 'little')
            f.seek(pe_offset)
            if f.read(4) != b'PE\x00\x00':
                return False
            machine = int.from_bytes(f.read(2), 'little')
            return machine == 0x8664  # AMD64
    except Exception:
        return False

print(is_64bit_pe(r"D:\Program Files\DataCollector\DataCollector.exe"))